from Base.Base import Base
from Page.Page_dl import Page
from selenium.webdriver.common.by import By

class Page_product(Page):
    product=(By.XPATH,'//*[@id="sidebar"]/div[2]/div[7]/h2')
    sidebar=(By.XPATH,'//*[@id="sidebar"]/div[2]/div[8]/ul/li[1]/div/a')
    add=(By.CLASS_NAME,'add')
    productCode=(By.CLASS_NAME,'required.textInput')
    productName=(By.XPATH,'//*[@id="navTab"]/div[2]/div[3]/div/form/div[1]/div/fieldset/dl[2]/dd/input')
    buttonContent=(By.XPATH,'//*[@id="navTab"]/div[2]/div[3]/div/form/div[2]/ul/li[1]/div/div/button')
    button_buttonHover=(By.CLASS_NAME,'button.buttonHover')
    nav_tab= (By.XPATH, '//*[@id="navTab"]/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[2]/div')

    def click_product(self):
        self.click(self.product)
        self.time(5)
    def click_sidebar(self):
        self.click(self.sidebar)
        self.time(5)
    def click_add(self):
        self.click(self.add)

    def send_product_code(self,info):
        self.send_keys(self.productCode,info)
    def send_product_name(self,info):
        self.send_keys(self.productName,info)
    def click_button(self):
        self.click(self.buttonContent)
    def click_button_Hover(self):
        self.click(self.button_buttonHover)
    def text(self):
        return self.get_element_text(self.nav_tab)